<%@ page language="java" import="java.util.*,java.io.*" pageEncoding="UTF-8"%>

<%@page import="sun.io.ByteToCharConverter"%>

<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head> 
    <title>平台首页</title>
    <link rel="stylesheet" type="text/css" href="css/style.css">
    
  </head>
  
  <body>
  <div id="log">
  		<c:if test="${user==null}">
  		<div class="logbgc"><a href="${pageContext.request.contextPath }/servlet/LoginUIServlet">登陆</a></div>			
		<div class="logbgc"><a href="${pageContext.request.contextPath }/servlet/RegisterUIServlet">注册</a></div>
  		</c:if>
  		<c:if test="${user!=null}">		
  		<div class="logbgc"><a href="${pageContext.request.contextPath }/servlet/QuitUIServlet">注销</a></div>
  		<div class="logbgc">${user.username }</div>
  		<div class="logbgc"><a href="${pageContext.request.contextPath }/servlet/ApplyUIServlet">报名</a></div>
  		<c:if test="${user.username=='aaa'}">
  		  	<div class="logbgc"><a href="${pageContext.request.contextPath }/servlet/EditUIServlet">编辑</a></div>
  		  	<div class="logbgcc"><a href="${pageContext.request.contextPath }/servlet/DownloadUIServlet">生成名单</a></div>
  		</c:if>
  		</c:if>
  </div>

  <div id="container">	
	<div>
		<h1 class="text-center">活动介绍</h1>	
		<div class="text-center">
		<p >
			<% 
			File f=new File(this.getServletContext().getRealPath("/file/content.doc"));
			FileInputStream fin = new FileInputStream(f);
			byte[] buf=new byte[1024];
			int r=0;
			request.setCharacterEncoding("utf-8");
			response.setCharacterEncoding("utf-8");
			while((r=fin.read(buf,0,buf.length))!=-1)
			{
				ByteToCharConverter converter = ByteToCharConverter.getConverter("gb2312");				
				char c[] = converter.convertAll(buf);			
				out.write(c,0,r);//response.getOutputStream()		
			}
			fin.close();
			%>
		</p>
		</div>
	</div>
	

  </div>

	
  </body>
</html>
